<?php
namespace addon\mall\validate;
use app\common\validate\ValidateBase;
use think\Db;
class OrderGoods extends ValidateBase
{
    // 验证规则
    protected $rule = [
        'order_id'                      => 'require|integer',         // 订单id
        'goods_id'                      => 'require|integer',      // 商品id 
        'goods_name'                    => 'require',      // 商品名称
        'market_price'                  => 'require|float',   //市场价
        'goods_price'                   => 'require|float',  //本店价
    ];

    // 验证提示
    protected $message = [
        'order_id.require'                  => '订单id不能为空',
        'goods_id.require'                  => '商品id不能为空',
        'goods_name.require'                => '商品名称不能为空',
        'market_price.require'              => '市场价不能为空',
        'goods_price.require'               => '本店价不能为空',
    ];

    // 应用场景
    protected $scene = [
        'add'=>['order_id','goods_id','goods_name','market_price','goods_price'],
    ];
}